//爆料页面渲染
var voteTpl = {};

voteTpl.bmMainHtml = template.compile(
    '<div>' +
    '        <div id="header">' +
    '            <div class="headerBg" style="background-image:url({{data.activity.background_image || \'img/bg.png\'}})">' +
    '            </div>' +
    '            <div class="header">' +
    // '                <h1 class="center">【活动名称】</h1>' +
    '                <h2 class="center"> {{data.activity.name}}</h2>' +
    '                {{if data.activity.isShowEnrollNumber == "on" || data.activity.isShowEnrollNumber == "" }}'+
    '                   <p class="des center"><span class="num">{{data.activity.applied}}</span>人已报名</p>' +
    '                {{/if}}' +
    '            </div>' +
    '            <ul class="actDes">' +
    '                <li class="borderNone">' +
    '                    <i class="icon1"></i><span>报名时间:</span>' +
    '                    <span class="time">{{data.activity.start_time}} - {{data.activity.end_time}}</span>  ' +
    '                </li>' +
    // '                <li>'+
    // '                    <i class="icon2"></i><span>活动时间:</span>'+
    // '                    <span class="time">2016.3.14 19:00 - 2016.3.20 19:00</p> '+
    // '                </li>'+
    // '                <li class="borderNone">'+
    // '                    <i class="icon3"></i><span>活动地点:</span>'+
    // '                    <span class="time">四川成都市</span> '+
    // '                </li>'+
    '            </ul>' +
    '        </div>' +
    '        <div id="btnWrap">' +
    // '            <a class="wybm" id="wybm">我要报名</a>' +
    '            <a class="wybm0" id="wybm"><img src="./img/enroll-btn.png" alt=""/></a>' +
    '        </div>' +
    '        <div class="actAbstract m10">' +
    '            <div class="actAbstractTitle">' +
    '                <span class="circle1 circle"></span>' +
    '                <span class="circle2 circle"></span>' +
    '                <span class="circle3 circle"></span>' +
    '                <a>活动描述</a>' +
    '                <span class="circle3 circle"></span>' +
    '                <span class="circle2 circle"></span>' +
    '                <span class="circle1 circle"></span>' +
    '            </div>' +
    '			 <div id="bmDes"></div>' +
    '        </div>' +
    '    </div>'
)

template.helper('urlFormat', function(url) {
    return encodeURI(url);
});


//是否有背景图,有无背景图显示不一样图标
template.helper('hasImg', function(url) {
    return url ? 'hasImg' : '';
});

//是否有背景图,有无背景图显示不一样图标
template.helper('len', function(url) {
    return url.length;
});

//处理投票类型
//不同类型显示不同图标

template.helper('voteType', function(type) {
    var voteType;
    if (type == 1) { //图片
        voteType = 'picCon'
    } else if (type == 2) { //
        voteType = 'audioCon'
    } else if (type == 3) {
        voteType = 'videoCon'
    } else if (type == 4) {
        voteType = ''
    }
    return voteType
});
voteTpl.bmFormHtml = template.compile(
    '<div id="bmWrap" style="display:none">' +
    '  <form id="bmForm">' +
    '{{each data as key i}}' +
    '{{if key.type == "text" }}' +
    '    <div class="ui-form-item ui-form-item-show ui-border-b">' +
    '         <label for="#">{{key.text}}：</label>' +
    '       {{if key.name == "mobile" }}' +
    '           <input type="text" name="{{key.name}}"" value="" onblur="upperCase(\'{{key.name}}\', \'{{key.text}}\')">' +
    '       {{else}}' +
    '           <input type="text" name="{{key.name}}"" value="">' +
    '       {{/if}}' +
    '    </div>' +
    '{{else if key.type == "textarea" }}'+
    '    <div class="ui-form-item ui-form-item-show ui-border-b">' +
    '         <label for="#">{{key.text}}：</label>' +
    '         <textarea type="text" name="{{key.name}}"" value=""></textarea>' +
    '    </div>' +
    '{{else if key.type == "radio" }}' +
    '            <div class="ui-border-b ui-form-radio">' +
    '                <label>' +
    '                    {{key.text}}：' +
    '                </label>' +
    '                <div>' +
    '					{{each key.options as key1 j}}' +
    '                    <p> ' +
    '                        <label class="ui-radio" for="{{key.name}}">' +
    '                            {{if j == 0}}'+
    '                            <input type="radio" checked="checked" name="{{key.name}}" value="{{key1}}">' +
    '                            {{else}}' +
    '                            <input type="radio" name="{{key.name}}" value="{{key1}}">' +
    '                            {{/if}}' +
    '                        </label>' +
    '                        <span>{{key1}}</span>' +
    '                    </p>' +
    '					{{/each}}' +
    '                </div>' +
    '            </div>' +
    '{{else if key.type == "select" }}' +
    ' 		<div class="ui-form-item ui-form-item-l ui-border-b">' +
    '                <label>' +
    '                    {{key.text}}：' +
    '                </label>' +
    '                <div class="ui-select">' +
    '                    <select name="{{key.name}}">' +
    '						{{each key.options as val key1}}' +
    '                            {{if key1 == 0}}'+
    '                        	 <option selected="selected" value="{{val}}">{{val}}</option>' +
    '                            {{else}}' +
    '                        	 <option  value="{{val}}">{{val}}</option>' +
    '                            {{/if}}' +
    '						{{/each}}' +
    '                    </select>' +
    '                </div>' +
    '            </div>' +
    '{{else if key.type == "checkbox" }}' +
    '            <div class="ui-border-b ui-form-checkbox">' +
    '                <label>' +
    '                    {{key.text}}：' +
    '                </label>' +
    '                <div>' +
    '					{{each key.options as key1 j}}' +
    '                    {{if j == 0}}'+
    '                    <p> ' +
    '                        <label class="ui-checkbox-s" for="{{key.name}}">' +
    '                            <input checked="checked" type="checkbox" name="{{key.name}}" value="{{key1}}">' +
    '                        </label>' +
    '                        <span>{{key1}}</span>' +
    '                    </p>' +
    '                    {{else}}' +
    '                    <p> ' +
    '                        <label class="ui-checkbox-s" for="{{key.name}}">' +
    '                            <input type="checkbox" name="{{key.name}}" value="{{key1}}">' +
    '                        </label>' +
    '                        <span>{{key1}}</span>' +
    '                    </p>' +
    '                    {{/if}}' +

    '					{{/each}}' +
    '                </div>' +
    '            </div>' +
    '{{else if key.type == "file" }}' +
    '  {{if  !key.file_type}}' +
    '<div class="ui-border-b ui-form-radio">' +
    '                <label>' +
    '                    {{key.text}}：' +
    '                </label>' +
    '                <div>' +
    '                    <div>' +
    '                        <!--用来存放item-->' +
    '                        <div id="fileList_{{key.name}}"  class="fileList uploader-list">' +
    '                        </div>' +
    '                         <div id="filePicker_{{key.name}}" class="filePicker"></div>' +
    '                    </div>' +
    '                </div>' +
    '            </div>' +
    '  {{else if  key.file_type}}' +
    '			<div class="ui-border-b ui-form-radio">' +
    '                <label>' +
    '                    {{key.text}}：' +
    '                </label>' +
    '                <div>' +
    '                    <div>' +
    '                        <!--用来存放item-->' +
    '                        <div id="fileList_{{key.name}}"  class="fileList uploader-list">' +
    '                        </div>' +
    '                         <div id="filePicker_{{key.name}}" class="filePicker"></div>' +
    '                    </div>' +
    '                </div>' +
    '            </div>' +
    '  {{/if}}' +
    '{{/if}}' +
    '{{/each}}' +
    '</form>' +
    '     <a id="bmBtn">提交报名</a>' +
    '</div>'
)
